package ${package}.util;

import org.springframework.security.GrantedAuthority;
import org.springframework.security.userdetails.User;

/**
 * UserDetails object with additional info.
 */
public class UserInfo extends User {
    private ${package}.model.entity.User user;

    public ${package}.model.entity.User getUser() {
        return user;
    }

    public UserInfo(${package}.model.entity.User user, GrantedAuthority[] authorities)
            throws IllegalArgumentException {
        super(user.getUsername(), user.getPassword(),
                user.isEnabled(), user.isEnabled(), user.isEnabled(), user.isEnabled(),
                authorities
        );
        this.user = user;
    }
}
